import qrcode
from PIL import Image
 
data = 'https://www.baidu.com'
qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_H, box_size=10, border=2)
qr.add_data(data)
qr.make(fit=True)
qr_img = qr.make_image(fill_color="black", back_color="white").convert('RGB')
 
logo_path = './status/haha.png'
logo = Image.open(logo_path)
logo = logo.resize((50, 50))
qr_img.paste(logo, (140, 140))
qr_img.save('./status/qrcode3.png')